//
//  YDHomeDynamicModel.m
//  PeiZiWangBei
//
//  Created by LK-IOS on 2017/11/21.
//  Copyright © 2017年 LK-IOS. All rights reserved.
//

#import "YDHomeDynamicModel.h"
#import <MJExtension/MJExtension.h>

@implementation YDHomeDynamicModel

-(NSString *)pzProfit
{
    if (!self.profit) {
        return @"---";
    }else{
        CGFloat numberF;
        if ([self.profit floatValue] <= 0) {
            numberF = [[self.profit pz_stringNumberByMultiplyingBy:@"-1.0"] floatValue];
        }else{
            numberF = [self.profit floatValue];
        }
        
        if (numberF < 10000.f) {
            NSString *result = [self.profit floatValue] <= 0 ? [[NSString stringWithFormat:@"%0.2f",numberF] pz_stringNumberByMultiplyingBy:@"-1.0"] : [NSString stringWithFormat:@"%0.2f",numberF];
            return [NSString stringWithFormat:@"+%@元",[NSString countNumAndChangeformat:result]];
        }else{//万
            //转换为万
            CGFloat wtotalF = numberF / 10000.f;
            NSString *result = [self.profit floatValue] <= 0 ? [[NSString stringWithFormat:@"%0.2f",wtotalF] pz_stringNumberByMultiplyingBy:@"-1.0"] : [NSString stringWithFormat:@"%0.2f",wtotalF];
            return [NSString stringWithFormat:@"+%@万",[NSString countNumAndChangeformat:result]];
        }
        
    }
    
}

-(NSString *)pzNumberOfStrand
{
    if (!self.profit) {//无盈利表示买入，显示手数
        CGFloat number = [self.numberOfStrand floatValue];
        if (number < 100.f) {
            return [NSString stringWithFormat:@"%@股" , [NSString countNumAndChangeformat:[NSString stringWithFormat:@"%@",self.numberOfStrand]]];
        }else{
            //转换为手
            CGFloat Snumber = number / 100.f;
            return [NSString stringWithFormat:@"%@手" , [NSString countNumAndChangeformat:[NSString stringWithFormat:@"%.f",Snumber]]];
        }
    }else{
        return @"---";
    }
}

@end
